package com.weayer.controller;

import com.weayer.dto.ResponseResult;
import com.weayer.response.AddTerminalResponse;
import com.weayer.response.SearchTerminalResponse;
import com.weayer.response.TrsearchResponse;
import com.weayer.service.TerminalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description: Service服务 - 地图 - 终端管理Controller
 * @author: Weayer
 **/
@RestController
@RequestMapping("/terminal")
public class TerminalController {
    @Autowired
    TerminalService terminalService;

    @PostMapping("/add")
    public ResponseResult<AddTerminalResponse> add(String name, String desc){
        return terminalService.add(name, desc);
    }

    @PostMapping("/search")
    public ResponseResult<List<SearchTerminalResponse>> search(String center, Integer  radius){
        return terminalService.search(center, radius);
    }

    @PostMapping("/trsearch")
    public ResponseResult<TrsearchResponse> trsearch(String tid, Long starttime , Long endtime){

        return terminalService.trsearch(tid,starttime,endtime);
    }
}
